package com.atguigu.gulimall.product.entity;

import com.atguigu.common.validator.customValidAnnotation.ValidValue;
import com.atguigu.common.validator.group.AddGroup;
import com.atguigu.common.validator.group.UpdateGroup;
import com.atguigu.common.validator.group.UpdateShowStatus;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import java.io.Serializable;
import java.util.Date;
import lombok.Data;
import org.hibernate.validator.constraints.URL;

import javax.validation.constraints.*;

/**
 * 品牌
 * 
 * @author zhangjianyou
 * @email 1844897920@qq.com
 * @date 2022-06-01 12:37:09
 */
@Data
@TableName("pms_brand")
public class BrandEntity implements Serializable {

	private static final long serialVersionUID = 1L;

	/**
	 * 品牌id
	 */
	@TableId
	@Null(groups = AddGroup.class,message = "品牌id必须为空")
	@NotNull(groups = {UpdateGroup.class, UpdateShowStatus.class},message = "品牌id不能为空")
	private Long brandId;
	/**
	 * 品牌名
	 */
	@NotBlank(message = "品牌名不能为空",groups = {AddGroup.class,UpdateGroup.class})
	private String name;
	/**
	 * 品牌logo地址
	 */
	@URL(message = "logo必须是一个合法的url地址",groups = {AddGroup.class,UpdateGroup.class})
	@NotEmpty(message = "logo不能为空",groups = AddGroup.class)
	private String logo;
	/**
	 * 介绍
	 */
	private String descript;
	/**
	 * 显示状态[0-不显示；1-显示]
	 */
	@ValidValue(value={0,1},groups = {AddGroup.class,UpdateGroup.class,UpdateShowStatus.class})
	@NotNull(message = "显示状态不能为空",groups = {AddGroup.class,UpdateShowStatus.class})
	private Integer showStatus;
	/**
	 * 检索首字母
	 */
	@NotEmpty(message = "首字母不能为空",groups = AddGroup.class)
	@Pattern(regexp = "^[a-zA-Z]$",message = "首字符必须为【a-z】或【A-Z】的任意一个字母",groups = {AddGroup.class,UpdateGroup.class})
	private String firstLetter;
	/**
	 * 排序
	 */
	@Min(value = 0,message = "排序必须为一个大于0的数",groups = {AddGroup.class,UpdateGroup.class})
	@NotNull(message = "排序不能为空",groups = AddGroup.class)
	private Integer sort;

}
